<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('任务图片详细')" />
    <th:block th:include="include :: bootstrap-fileinput-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-astSite-edit" th:object="${taskUserList}">
            <input type="hidden" id="imgList" name="imgList" th:field="*{imgList}">

            <div class="form-group">
                <label class="font-noraml">站点图片：</label>
                <div class="file-loading">
                    <input id="multipleFile" name="files" type="file" multiple>
                </div>
            </div>

        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: bootstrap-fileinput-js" />
    <script th:inline="javascript">
        var prefix = ctx + "asset/astSite";

        var imgVal = $("#imgList").val()
        if(imgVal){
            imgVal = imgVal.split(",")
        }
        $("#multipleFile").fileinput({
            uploadUrl: ctx + 'common/uploads',
            uploadAsync: false,
            initialPreviewAsData: true,
            initialPreview: imgVal,
            // initialPreviewConfig:[{key:0,url:"http://localhost/profile/upload/2024/07/25/3_20240725160544A009.jpg"},{key:1,url:"http://localhost/profile/upload/2024/07/25/3_20240725160544A009.jpg"}]
        }).on('filebatchuploadsuccess', function (event, data, previewId, index) {
            var rsp = data.response;
            var imgList = $("#imgList").val()
            if(imgList){
                imgList = imgList+","+rsp.urls
                $("#imgList").val(imgList)
            }else{
                $("#imgList").val(rsp.urls)
            }
        }).on('fileremoved', function (event, id, index) {
            $("input[name='" + event.currentTarget.id + "']").val('')


        }).on('fileclear', function (event, id, index) {
            $("#imgList").val("")
        })
        $("#multipleFile").fileinput('_initFileActions');


    </script>
</body>
</html>